package com.bix.util.blizfiles.blp;

import java.io.IOException;
import java.io.InputStream;

import com.jme.image.Image;
import com.jme.util.ImageLoader;
import com.jme.util.TextureManager;

/**
 * This is a custom adapter to provide an ImageLoader for Blizzard's BLP/BLP2
 * image format.  It implements the jMonkeyEngine ImageLoader interface so that
 * it can be directly used by the JME framework.
 * 
 *	@author		squid
 *
 *	@version	1.0.0
 */
public class BLPImageLoader extends BLPFile implements ImageLoader {
	public Image load (InputStream is) throws IOException {
		try {
			super.read(is);
			return TextureManager.loadImage(super.getImage(), false);
		} catch (BLPFileException e) {
			throw new IOException (e);
		}
	}
}